<body>
    <form id="my-form">
        <div id="tools" class="datagrid-toolbar">
            <a id="closeBtn" name="backOk" class="easyui-linkbutton l-btn l-btn-plain" iconcls="icon-close"
                plain="true"><span class="l-btn-left"><span
                        class="l-btn-text icon-close l-btn-icon-left">关闭</span></span></a>
        </div>
        <p id="errorMsg" style="color:red;margin-top:5px;"></p>
        <table class="formTable">
            <tbody>
                <tr>
                    <td class="tdc1" style="width:150px;">
                        申请人：
                    </td>
                    <td>
                        <input type="text" name="applyUserName" id="applyUserName"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="applyUserId" id="applyUserId" value="1815">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1" style="width:150px;">
                        部门/项目主管：
                    </td>
                    <td>
                        <input type="text" name="approvalNames" id="approvalNames"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="approvalIds" id="approvalIds" value="697">
                    </td>
                </tr>
                <tr>
                    <td class="tdc1" style="width:150px;">
                        副总经理：
                    </td>
                    <td>
                        <input type="text" name="managername" id="managername"
                            class="easyui-validatebox validatebox-text" readonly="">
                        <input type="hidden" name="managerid" id="managerid" value="566">
                    </td>
                </tr>
                <!--
				<tr>
					<td class="tdc1" style="width:150px;">
						总经理：
					</td>
					<td>
						<input type="text" name="managerDname" id="managerDname" class="easyui-validatebox" readonly/>
						<input type="hidden" name="managerDid" id="managerDid"/>
					</td>
				</tr>
				<tr>
					<td class="tdc1" style="width:150px;">
						董事长：
					</td>
					<td>
						<input type="text" name="presidentname" id="presidentname" class="easyui-validatebox" readonly/>
						<input type="hidden" name="presidentid" id="presidentid"/>
					</td>
				</tr>
				-->
                <tr>
                    <td class="tdc1" style="width:150px;">
                        申请时间：
                    </td>
                    <td>
                        <input type="text" name="commitDate" id="commitDate" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        起止时间：
                    </td>
                    <td>
                        <input type="text" name="starDate" id="starDate" class="easyui-validatebox validatebox-text"
                            readonly="">-<input type="text" name="enDate" id="enDate"
                            class="easyui-validatebox validatebox-text" readonly="">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        天数：
                    </td>
                    <td>
                        <input type="text" name="days" id="days" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        出差城市：
                    </td>
                    <td>
                        1、<input type="text" name="cityName1" id="cityName1" class="easyui-validatebox validatebox-text"
                            readonly=""><br>
                        2、<input type="text" name="cityName2" id="cityName2" class="easyui-validatebox validatebox-text"
                            readonly=""><br>
                        3、<input type="text" name="cityName3" id="cityName3" class="easyui-validatebox validatebox-text"
                            readonly=""><br>
                        4、<input type="text" name="cityName4" id="cityName4" class="easyui-validatebox validatebox-text"
                            readonly=""><br>
                        5、<input type="text" name="cityName5" id="cityName5" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        出差事由：
                    </td>
                    <td>
                        <textarea name="visitingReson" id="visitingReson" style="width:70%;height:70px"
                            readonly=""></textarea>
                    </td>
                </tr>

                <tr>
                    <td class="tdc1">
                        差旅费支出单位：
                    </td>
                    <td>
                        <input type="text" name="expendUnit" id="expendUnit" class="easyui-validatebox validatebox-text"
                            readonly="">
                    </td>
                </tr>


            </tbody>
        </table>
    </form>
    <div style="margin-left:10px;">
        <div id="showFiles">
        </div>
    </div>
    <br>
    <div id="search" class="datagrid-toolbar" style="display:none;">
        <input type="hidden" name="bid" id="bid" value="15634">
    </div>
    <div class="panel datagrid" style="width: auto;">
        <div class="datagrid-wrap panel-body panel-body-noheader" title="" style="width: 739px; height: auto;">
            <div class="datagrid-view" style="width: 739px; height: 50px;">
                <style type="text/css">
                    div.datagrid-cell-c1-personName {
                        width: 192px;
                    }

                    div.datagrid-cell-c1-sex {
                        width: 142px;
                    }

                    div.datagrid-cell-c1-unitName {
                        width: 292px;
                    }

                    div.datagrid-cell-c1-duty {
                        width: 292px;
                    }
                </style>
                <div class="datagrid-view1" style="width: 41px;">
                    <div class="datagrid-header" style="width: 41px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td rowspan="0">
                                            <div class="datagrid-header-rownumber"></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 41px; height: 25px;">
                        <div class="datagrid-body-inner">
                            <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0"
                                style="table-layout: auto;">
                                <tbody>
                                    <tr id="datagrid-row-r1-1-0" datagrid-row-index="0" class="datagrid-row"
                                        style="height: 25px;">
                                        <td class="datagrid-td-rownumber">
                                            <div class="datagrid-cell-rownumber">1</div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-footer" style="width: 41px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <div class="datagrid-view2" style="width: 698px;">
                    <div class="datagrid-header" style="width: 698px; height: 24px;">
                        <div class="datagrid-header-inner" style="display: block;">
                            <table class="datagrid-htable" border="0" cellspacing="0" cellpadding="0"
                                style="height: 25px;">
                                <tbody>
                                    <tr class="datagrid-header-row">
                                        <td field="id">
                                            <div class="datagrid-header-check"><input type="checkbox"></div>
                                        </td>
                                        <td field="personName">
                                            <div class="datagrid-cell" style="width: 128px;"><span>姓名</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="sex">
                                            <div class="datagrid-cell" style="width: 94px;"><span>性别</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="unitName">
                                            <div class="datagrid-cell" style="width: 196px;"><span>工作单位</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                        <td field="duty">
                                            <div class="datagrid-cell" style="width: 199px;"><span>职务</span><span
                                                    class="datagrid-sort-icon">&nbsp;</span></div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="datagrid-body" style="width: 698px; height: 25px;">
                        <table class="datagrid-btable" cellspacing="0" cellpadding="0" border="0"
                            style="table-layout: auto;">
                            <tbody>
                                <tr id="datagrid-row-r1-2-0" datagrid-row-index="0" class="datagrid-row"
                                    style="height: 25px;">
                                    <td field="id">
                                        <div style="" class="datagrid-cell-check "><input type="checkbox" name="id"
                                                value="21421"></div>
                                    </td>
                                    <td field="personName">
                                        <div style="height:auto;" class="datagrid-cell datagrid-cell-c1-personName">舒沛谙
                                        </div>
                                    </td>
                                    <td field="sex">
                                        <div style="height:auto;" class="datagrid-cell datagrid-cell-c1-sex">男</div>
                                    </td>
                                    <td field="unitName">
                                        <div style="height:auto;" class="datagrid-cell datagrid-cell-c1-unitName">
                                            上海启迪创业孵化器有限公司</div>
                                    </td>
                                    <td field="duty">
                                        <div style="height:auto;" class="datagrid-cell datagrid-cell-c1-duty">项目经理</div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="datagrid-footer" style="width: 698px;">
                        <div class="datagrid-footer-inner" style="display: none;"></div>
                    </div>
                </div>
                <table id="list_data" style="display: none;"></table>
            </div>
            <div class="datagrid-pager pagination">
                <table cellspacing="0" cellpadding="0" border="0">
                    <tbody>
                        <tr>
                            <td><select class="pagination-page-list">
                                    <option>10</option>
                                    <option>20</option>
                                    <option>30</option>
                                    <option>40</option>
                                    <option>50</option>
                                </select></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-first">&nbsp;</span></span></span></a>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-prev">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><span style="padding-left:6px;">第</span></td>
                            <td><input class="pagination-num" type="text" value="1" size="2"></td>
                            <td><span style="padding-right:6px;">共1页</span></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-next">&nbsp;</span></span></span></a></td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain l-btn-disabled" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-last">&nbsp;</span></span></span></a></td>
                            <td>
                                <div class="pagination-btn-separator"></div>
                            </td>
                            <td><a href="javascript:void(0)" class="l-btn l-btn-plain" id=""><span
                                        class="l-btn-left"><span class="l-btn-text"><span
                                                class="l-btn-empty pagination-load">&nbsp;</span></span></span></a></td>
                        </tr>
                    </tbody>
                </table>
                <div class="pagination-info">显示1到1,共1记录</div>
                <div style="clear:both;"></div>
            </div>
        </div>
    </div><br>
    <div style="margin-left:10px;">
        <div id="showRecords">
            <div style="margin-top:8px;margin-bottom:8px;">审核人：王维<span style="margin-left:15px;">审核时间：2024-12-24
                    13:44:22</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">审核人：韩威<span style="margin-left:15px;">审核时间：2024-12-24
                    15:06:36</span><span style="margin-left:15px;">审核选项：同意</span><span
                    style="margin-left:15px;">审核意见：同意</span></div>
            <div style="margin-top:8px;margin-bottom:8px;">复核人：王影<span style="margin-left:15px;">复核时间：2024-12-24
                    17:17:56</span><span style="margin-left:15px;">复核选项：同意</span><span
                    style="margin-left:15px;">复核意见：同意</span></div>
        </div>
    </div>


    <script>

        function checkFormMe(form) {

            return $('#my-form').form('validate');
        }
        var type = $.getUrlParam("type");
        $("#type").val(type);

        var p_id = $.getUrlParam("id");

        var process_id = $.getUrlParam("processid");
        if (process_id != null) {
            $.ajax({
                type: "GET",
                url: contextPath + "manager/approvalprocess/getBeanIdByProcessId/" + process_id + "/" + type,
                data: null,
                dataType: "json",
                success: function (data) {
                    if (data && data.handleMsg.status == 1) {
                        p_id = data.id;
                        if (p_id != null) {
                            $("#bid").val(p_id);
                        }

                        loadBaseModel(p_id);
                        loadDetails(p_id);
                        loadRecord(process_id);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }

            });
        } else {
            loadBaseModel(p_id);
            loadDetails(p_id);
            loadRecord(process_id);
        }

        function loadBaseModel(p_id) {
            var BaseModel = Backbone.Model.extend({ urlRoot: contextPath + 'manager/businessMissi' });
            var baseModel;

            if (p_id == null) {
                baseModel = new BaseModel();
            } else {
                baseModel = new BaseModel({ id: p_id, i: new Date().getTime() });
            }
            var baseView = new BaseView({ el: $("#my-form"), model: baseModel });
            if (p_id != null) {
                baseView.doLoad(loadMe);
            }
        }

        function loadMe(model, response, options) {
            if (model.get("approvalProcess")) {
                $("#applyUserName").val(model.get("approvalProcess").applyUserName);
                $("#applyUserId").val(model.get("approvalProcess").applyUserId);
                $("#applyDeptName").val(model.get("approvalProcess").applyDeptName);
                $("#applyDeptId").val(model.get("approvalProcess").applyDeptId);
                $("#type").val(model.get("approvalProcess").type);
                $("#commitDate").val(model.get("approvalProcess").commitDate);
            }
        }




        function loadDetails(p_id) {
            $('#list_data').datagrid({
                url: contextPath + "manager/businessMissiPersons?i=" + new Date().getTime(),
                fitColumns: true,
                singleSelect: false,
                rownumbers: true,
                pagination: true,
                sortName: 'id',
                sortOrder: 'desc',
                method: 'POST',
                onRowContextMenu: onRowContextMenu,//右键菜单
                queryParams: { "bid": p_id },
                columns: [[
                    { field: 'id', checkbox: true },
                    { field: 'personName', title: '姓名', width: 200 },
                    { field: 'sex', title: '性别', width: 150 },
                    { field: 'unitName', title: '工作单位', width: 300 },
                    { field: 'duty', title: '职务', width: 300 }
                ]]
            });
        }

        //查询
        function query() {
            searchGo(contextPath + "manager/borrowSealDetails?i=" + new Date().getTime(), "#search", "#list_data");
        }

        ////加载领导审核意见
        function loadRecord(process_id) {
            $.ajax({
                type: "POST",
                url: contextPath + "manager/approvalRecords/listApprovalRecord/" + process_id,
                data: {},
                dataType: "json",
                success: function (data) {
                    if (data) {
                        var rHtml = "";
                        var msg = "审核"
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].userType == 5) {
                                msg = "复核";
                            } else {
                                msg = "审核"
                            }
                            rHtml += "<div style=\"margin-top:8px;margin-bottom:8px;\">" + msg + "人：" + data[i].approvalUser.truename + "";
                            if (data[i].approvalDate == null) {
                                rHtml += "<span style=\"margin-left:15px;\">尚未" + msg + "</span>";
                            } else {
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "时间：" + data[i].approvalDate + "</span>";
                                if (data[i].approvalType == 1) {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：同意</span>";
                                } else {
                                    rHtml += "<span style=\"margin-left:15px;\">" + msg + "选项：不同意</span>";
                                }
                                rHtml += "<span style=\"margin-left:15px;\">" + msg + "意见：" + data[i].opinion + "</span>";
                            }
                            rHtml += "</div>";
                        }
                        $("#showRecords").html(rHtml);
                    }
                },
                error: function (response) {
                    $.messager.alert("提示", "出错了，请联系管理员!", 'error', function (rt) {
                        $.messager.alert("提示", response.responseText, 'error');
                    });
                }
            });
        }

        var userType = $.getUrlParam("userType");

    </script>
    <div id="loading1"
        style="position: absolute; left: 0px; top: 0px; width: 100%; height: 703px; background: rgb(232, 232, 232); opacity: 0.5; z-index: 10000; display: none;">
    </div>
    <div id="loading2" class="panel-loading"
        style="position: fixed; top: 38%; left: 41%; border: 2px solid rgb(149, 184, 231); width: 160px; font-size: 14px; z-index: 10001; background: url(&quot;/system/jquery/themes/themes1/images/loading-1.gif&quot;) 10px 8px no-repeat rgb(255, 255, 255); display: none;">
        正在处理，请稍等...</div>
</body>